﻿using System;
using System.Collections.Generic;
//using System.ComponentModel.Composition;
using System.Drawing;
using System.Drawing.Drawing2D;
//using System.Linq;
using System.Text;
//using System.Threading.Tasks;
using TRicheControl.DefaultControlStyles.Helper;
using TRicheControl.Interface.ControlStyle;

namespace TRicheControl.DefaultControlStyles
{
    //[Export(typeof(ICheckBoxStyle))]
    public class CheckBoxStyle : ICheckBoxStyle
    {
        private Pen mEanbelCheckBoxBorderPen;
        private Pen mEanbelCheckHookPen;

        public CheckBoxStyle()
        {
            mEanbelCheckBoxBorderPen = new Pen(Color.Black);
            mEanbelCheckHookPen = new Pen(Color.Green, 2);
        }

        public void DrawEanbelCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
            g.DrawPath(mEanbelCheckHookPen, GetHookPath(boxrect));
            g.DrawRectangle(mEanbelCheckBoxBorderPen ,boxrect);
        }

        public void DrawEanbelUnCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
            g.DrawRectangle(mEanbelCheckBoxBorderPen, boxrect);
        }

        public void DrawUnEanbelCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawUnEanbelUnCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawMouseEnterEanbelCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawMouseEnterEanbelUnCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawMouseEnterUnEanbelCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawMouseEnterUnEanbelUnCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawMouseDownEanbelCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawMouseDownUnEanbelCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawMouseDownEanbelUnCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawMouseDownUnEanbelUnCheckBox(System.Drawing.Graphics g, System.Drawing.Rectangle boxrect)
        {
            DrawHelper.SetGraphics(g);
        }

        public void DrawString(string text, System.Drawing.Font textFont, System.Drawing.Color textColor, System.Drawing.Graphics g, System.Drawing.Rectangle rect)
        {
            DrawHelper.SetGraphics(g);
            g.DrawString(text, textFont, new SolidBrush(textColor), rect);
        }

        public void DrawBackColor(System.Drawing.Graphics g, System.Drawing.Rectangle rect, System.Drawing.Color color)
        {
            DrawHelper.SetGraphics(g);
        }
        
        private GraphicsPath GetHookPath(Rectangle rect)
        {
            GraphicsPath hookPath = new GraphicsPath();
            Point turnPoint =  new Point(rect.X + (rect.Width / 2), rect.Y + rect.Height - 3);
            hookPath.AddLine(new Point(rect.X + 2, rect.Y + (rect.Height / 2)), turnPoint);
            hookPath.AddLine(turnPoint, new Point(rect.X + rect.Width - 2, rect.Y + 2));
            return hookPath;
        }

        public void DrawBackGroundImage(Graphics g, Image image, Rectangle rect, System.Windows.Forms.ImageLayout layout)
        {
            DrawHelper.SetGraphics(g);
        }
    }
}
